﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PUCLibrary
{
    [Serializable]
    public class Modulo
    {
        public DayOfWeek DiaSemana { get; private set; }
        public int ModuloNum { get; private set; }
        public string ModuloSala { get; private set; }
        public string TipoModulo { get; private set; }

        public Modulo(string diaSemana, int moduloNum, string moduloSala, string tipoModulo)
        {
            ModuloNum = moduloNum;
            ModuloSala = moduloSala;
            TipoModulo = tipoModulo;

            switch (diaSemana.Trim().ToUpper())
            {
                case "L":
                    DiaSemana = DayOfWeek.Monday;
                    break;
                case "M":
                    DiaSemana = DayOfWeek.Tuesday;
                    break;
                case "W":
                    DiaSemana = DayOfWeek.Wednesday;
                    break;
                case "J":
                    DiaSemana = DayOfWeek.Thursday;
                    break;
                case "V":
                    DiaSemana = DayOfWeek.Friday;
                    break;
                case "S":
                    DiaSemana = DayOfWeek.Saturday;
                    break;
                default:
                    throw new ArgumentException("Error parseando dia de la semana.");
            }
        }

        public override string ToString()
        {
            //Ej: W, Mod:5 [Cat]
            return String.Format("{0}, Mod:{1} ({2}) [{3}]", Enum.GetName(typeof(DayOfWeek), DiaSemana), ModuloNum, ModuloSala, TipoModulo);
        }
    }
}
